<?php 
include("_mysql.php");
include("_settings.php");
include("_functions.php");

if (isset($_POST["newsID"])) {
	$newsID = $_POST["newsID"];
	$result = safe_query("SELECT comments.*, user.username FROM comments LEFT JOIN user ON user.userID = comments.poster WHERE comments.newsID = " . $newsID . " ORDER BY DATE DESC");
	$num_rows = mysql_num_rows($result);
?>
				<h3><?=$num_rows?> comments</h3>
					<ul>
						<?php 
						while($comment = mysql_fetch_array($result ))
						{
						?>
						<li class="parent">
							<div class="commentWrap">
								<h4><?=$comment["username"]?></h4>
								<div class="commentContent">
									<?=$comment["content"]?> 
								</div>
								<div class="commentExInfo clearafter">
									<span><?=ago($comment["date"])?></span>
									<div class="right">
										<a href="#">Like</a>
										<a href="#">Reply</a>
									</div>
								</div>
							</div>							
						</li>
						<?php 
						}
						?>
						<!-- 
						<li class="parent">
							<div class="commentWrap">
								<h4>SomeUsrname</h4>
								<div class="commentContent">
									Proin urna turpis, eleifend eu vehicula id, dignissim sit amet mi. Donec justo lacus, consequat sit amet mollis vel, tempus eu nisl. Ut vitae nibh eu lectus fringilla vestibulum eu eu lacus. Phasellus iaculis erat sed arcu venenatis cursus. 
								</div>
								<div class="commentExInfo clearafter">
									<span>6 days ago</span>
									<div class="right">
										<a href="#">Like</a>
										<a href="#">Reply</a>
									</div>
								</div>
							</div>
							<ul>
								<li class="child">
									<div class="commentWrap">
										<h4>SomeUsrname</h4>
										<div class="commentContent">
											Aliquam posuere, nibh sit amet tincidunt posuere, libero nulla venenatis tellus, non malesuada diam metus vel ligula. Nullam rutrum felis a lacus convallis placerat. Vivamus ullamcorper purus at justo pharetra venenatis. Nunc quis tortor nulla, et pretium ipsum. Nullam ut placerat arcu. Etiam sagittis congue est vitae vulputate. 
										</div>
										<div class="commentExInfo clearafter">
											<span>6 days ago</span>
											<span>in reply to CoolUsrname</span>
											<span>1 Like</span>
											<span class="flag"><img src="images/flag.png"></span>
											<div class="right">
												<a href="#">Like</a>
												<a href="#">Reply</a>
											</div>
										</div>
									</div>
									<ul>
										<li class="child">
											<div class="commentWrap">
												<h4>SomeUsrname</h4>
												<div class="commentContent clearafter">
													Aliquam posuere, nibh sit amet tincidunt posuere, libero nulla venenatis tellus, non malesuada diam metus vel ligula. Nullam rutrum felis a lacus convallis placerat. 
												</div>
												<div class="commentExInfo">
													<span>6 days ago</span>
													<div class="right">
														<a href="#">Like</a>
														<a href="#">Reply</a>
													</div>
												</div>
											</div>							
										</li>								
									</ul>
								</li>								
							</ul>	
						</li>
						<li class="parent">
							<div class="commentWrap">
								<h4>SomeUsrname</h4>
								<div class="commentContent">
									Aliquam posuere, nibh sit amet tincidunt posuere, libero nulla venenatis tellus, non malesuada diam metus vel ligula. 
								</div>
								<div class="commentExInfo clearafter">
									<span>6 days ago</span>
									<div class="right">
										<a href="#">Like</a>
										<a href="#">Reply</a>
									</div>
								</div>
							</div>							
						</li>
						 -->						
					</ul>
<?php 
}
?>	